import java.util.ArrayList;

interface ElementAvecPrio{
	int priorite();
}

 class FileAttente<A extends ElementAvecPrio> {
	protected ArrayList<A> contenu;
	
	public FileAttente(){
		contenu=new ArrayList<A>();
	}
	
	private A lePlusPrio(){
		A a=null;
		int p=Integer.MAX_VALUE;
		for(A e : contenu){
			if (e.priorite()<p){
				p=e.priorite();
				a=e;
			}
		}
		return a;
	}
	
	public A sort(){
		A p=null;
		if(! contenu.isEmpty()){
			p=lePlusPrio();
			contenu.remove(p);
		}
		return p;
	}
	
	public boolean estVide(){
		return contenu.isEmpty();
	}
	
	public String toString(){
		return ""+contenu;
	}
}



public class exo3 {

	
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
